Skip to content

[codex] fix runtime guard stale log filtering#226

Merged
Pigbibi merged 1 commit into
mainfrom
codex/fix-runtime-guard-stale-logs-20260702
Jul 1, 2026
Merged

[codex] fix runtime guard stale log filtering#226
Pigbibi merged 1 commit into
mainfrom
codex/fix-runtime-guard-stale-logs-20260702

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Ignore disabled runtime targets when deriving Cloud Run services from target JSON.
  • Filter Cloud Scheduler failures using the matching service's latest-ready revision window, consistent with Cloud Run log filtering.
  • Add regression coverage for disabled targets and scheduler stale-log filtering.

Test Plan

  • python3 -m pytest tests/test_cloud_run_runtime_guard.py -q
  • git diff --check

@Pigbibi Pigbibi enabled auto-merge (squash) July 1, 2026 22:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 709468fd29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

matches = [
service_since
for service, service_since in service_since_by_name.items()
if any(alias and alias in job_name for alias in _service_job_aliases(service))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match scheduler jobs to only their owning service

In multi-service runtime guards where one service alias is a substring of another service's scheduler job, this substring match can associate a job with multiple services and then max(matches) uses the newest unrelated revision window. For example, charles-schwab-live-u7654-mega-service-scheduler also matches the alias charles-schwab derived from charles-schwab-service; if that shorter service was deployed later, legitimate scheduler failures for the live service before that timestamp are skipped as stale. The scheduler entry should resolve to the best/exact owning service rather than every substring alias.

Useful? React with 👍 / 👎.

Comment on lines +226 to +230
for key in ("runtime_target_enabled", "RUNTIME_TARGET_ENABLED"):
if key in target:
return _coerce_bool(target.get(key), True)
if key in runtime_target:
return _coerce_bool(runtime_target.get(key), True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor disabled flags under target env

When CLOUD_RUN_SERVICE_TARGETS_JSON uses the same per-target shape accepted by scripts/build_cloud_run_env_sync_plan.py ({"env": {"RUNTIME_TARGET_ENABLED": "false"}}), _target_enabled() still returns true because it checks only the top-level target and runtime_target object. _load_services() then includes that disabled service via the target's service_name, so the guard continues querying and alerting on services the sync plan marks disabled; include the target env mapping when evaluating the flag.

Useful? React with 👍 / 👎.

@Pigbibi Pigbibi merged commit 6927194 into main Jul 1, 2026
5 of 6 checks passed
@Pigbibi Pigbibi deleted the codex/fix-runtime-guard-stale-logs-20260702 branch July 1, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant